package com.cbg.label.repository;

import com.cbg.label.entity.ZfwLabel;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 标签库，存放所有已创建的标签 repository
 *
 * @author wangjuzheng
 * @since 2019-10-16
 */
@Repository
public interface IZfwLabelRepository extends CrudRepository<ZfwLabel, Long>, JpaSpecificationExecutor<ZfwLabel> {

    /**
     * 查询标签库信息
     *
     * @param id 标签id
     * @return 标签信息
     */
    @Query("select z from ZfwLabel z where z.id=?1")
    ZfwLabel getZfwLabel(Long id);

    /**
     * 根据标签名称查询标签信息
     *
     * @param label 标签名称
     * @return 标签信息
     */
    List<ZfwLabel> findByLabel(String label);
}
